Skip to content

Conversation

@sethmlarson
Copy link
Contributor

@sethmlarson sethmlarson commented Jan 12, 2026

Created a list of files and directories that should trigger a re-run of the python3-libraries fuzzers. Now that the Python repository is the home for this fuzzer it should be easier for Python core developers to fix issues with the fuzzer in case there are issues.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also rename most of the "library"/"libraries"/"LIBRARY" to "stdlib"/"STDLIB" and it'd be clearer this is running on the standard library and not any third-party library code.

@sethmlarson
Copy link
Contributor Author

I think we could also rename most of the "library"/"libraries"/"LIBRARY" to "stdlib"/"STDLIB" and it'd be clearer this is running on the standard library and not any third-party library code.

I agree with this, we can change most of our uses to "stdlib" within this PR except for oss-fuzz-project-name. I can handle that in a separate PR since we'll have to wait for OSS-Fuzz maintainers to rename the project.

@sethmlarson
Copy link
Contributor Author

Thanks @StanFromIreland and @hugovk for the reviews! I've moved to a reusable workflows approach. I'll try pushing a commit modifying one of the libraries to check that the workflow fires correctly.

Comment on lines +12 to +14
permissions:
contents: read
security-events: write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 99% sure this is required in the calling jobs in build.yml too. But maybe there's an exception for in-tree workflows. I haven't tested this in a while, though.

If jobs.<job_id>.permissions is not specified in the calling job, the called workflow will have the default permissions for the GITHUB_TOKEN.

(https://docs.github.com/en/actions/reference/workflows-and-actions/reusing-workflow-configurations#supported-keywords-for-jobs-that-call-a-reusable-workflow)

GITHUB_TOKEN permissions can only be the same or more restrictive in nested workflows. For example, in the workflow chain A > B > C, if workflow A has package: read token permission, then B and C cannot have package: write permission.

(https://docs.github.com/en/actions/reference/workflows-and-actions/reusing-workflow-configurations#access-and-permissions-for-nested-workflows)


I think, the above implies that the calling workflow should at least allow the minimum privileges needed here.

strategy:
fail-fast: false
matrix:
sanitizer: [address, undefined, memory]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could pass this through inputs instead of having a matrix here? The idea of reusable-*.yml modules was that the matrices are kept on the top layer (build.yml) where the context is, while the steps are in single-job matrix-less reusable workflows.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calling side for this would be #143749 (comment)

cifuzz:
name: CIFuzz
runs-on: ubuntu-latest
timeout-minutes: 60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend having timeout-minutes in the inputs too. This allows having all the numbers surfaced in build.yml.

value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
run-ci-fuzz-stdlib:
description: Whether to run the CIFuzz job for 'python3-libraries' fuzzer
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
Copy link
Contributor

@webknjaz webknjaz Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sethmlarson did you mark @StanFromIreland's suggestion as resolved by accident?

Suggested change
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz-stdlib }} # bool

EDIT: corrected the referenced output name in my suggestion too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought I had fixed that instance but I guess not? Thanks for catching this.

Comment on lines +642 to +647
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
permissions:
security-events: write
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
permissions:
security-events: write

(https://github.com/python/cpython/pull/143749/files#r2686916751)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, looks like it is needed the calling jobs in build.yml, because the CI didn't start:

The workflow is not valid. .github/workflows/build.yml (Line: 639, Col: 3): Error calling workflow 'python/cpython/.github/workflows/reusable-cifuzz.yml@98b701b'. The workflow is requesting 'security-events: write', but is only allowed 'security-events: none'.

https://github.com/python/cpython/actions/runs/20936855037?pr=143749

Maybe we try this smaller change to validate the permissions, before refactoring the matrix?

Comment on lines +642 to +650
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: python3-libraries
Copy link
Contributor

@webknjaz webknjaz Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, it's probably nicer to try collapsing these into a single matrix:

Suggested change
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: python3-libraries
if: >-
contains(
[
needs.build-context.outputs.run-ci-fuzz,
needs.build-context.outputs.run-ci-fuzz-stdlib
],
'true'
)
permissions:
security-events: write
strategy:
fail-fast: false
matrix:
sanitizer:
- address
- undefined
- memory
oss-fuzz-project-name:
- cpython3
- python3-libraries
exclude:
- oss-fuzz-project-name: >-
${{
needs.build-context.outputs.run-ci-fuzz == 'true'
&& 'dummy sentinel 🤪'
|| 'cpython3'
}}
- oss-fuzz-project-name: >-
${{
needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
&& 'dummy sentinel 🤪'
|| 'python3-libraries'
}}
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: ${{ matrix.oss-fuzz-project-name }}
sanitizer: ${{ matrix.sanitizer }}
timeout-minutes: 60

(an untested idea borrowed from

is-fork: # only used for the exclusion trick
- ${{ github.repository_owner != 'python' }}
free-threading:
- false
- true
exclude:
- os: ghcr.io/cirruslabs/macos-runner:sonoma
is-fork: true
- os: macos-14
is-fork: false
- os: macos-13
free-threading: true
)

@hugovk
Copy link
Member

hugovk commented Jan 13, 2026

(I resolved the conflict)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants